package com.example.redis.adviced.redis.bean;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.sql.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("emps") // 设置实体类对应的表名
public class Employee {

    // value属性：设置主键字段
    // type属性：设置主键生成策略
    @TableId(value = "employee_id", type = IdType.AUTO)
    private Long employeeId;

    @TableField(value = "first_name")
    private String firstName;

    @TableField(value = "last_name")
    private String lastName;

    @TableField(value = "email")
    private String email;

    @TableField(value = "phone_number")
    private String phoneNumber;

    @TableField(value = "hire_date")
    private Date hireDate;

    @TableField(value = "job_id")
    private String jobId;

    @TableField(value = "salary")
    private double salary;

    @TableField(value = "commission_pct")
    private Double commissionPct;

    @TableField(value = "manager_id")
    private Integer managerId;

    @TableField(value = "department_id")
    private String departmentId;

    @TableField(value = "is_deleted")
    @TableLogic // 逻辑删除字段: 0: 未删除, 1: 已删除
    private Integer isDeleted;

    @TableField(exist = false)
    private Department department;

    @Version // 版本字段: 用于乐观锁
    @TableField(value = "version")
    private Integer version;

    @TableField(value = "gender")
    private Integer gender;
}
